package io.gitee.kenewstar.dbmq.config;

import io.gitee.kenewstar.dbmq.data.DbMongoHandler;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.core.MongoTemplate;

/**
 * @author kenewstar
 */
@AutoConfigureOrder(Integer.MAX_VALUE)
@Configuration
@ConditionalOnClass(MongoTemplate.class)
public class DbMongoConfig {

    @Bean
    @ConditionalOnBean(MongoTemplate.class)
    public DbMongoHandler dbMongoHandler(MongoTemplate mongoTemplate) {
        return new DbMongoHandler(mongoTemplate);
    }


}
